<?php
/**
 * @Author: your name
 * @Date: 2020-03-28 20:52:38
 * @LastEditTime: 2020-03-28 21:20:35
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \degsonData\application\controllers\Welcome.php
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Demo extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		
	}

	// demo
	public function connect()
	{

		$login=array("login" => "DEGSONDEV", "password" => "808906");
		$soap=new SoapClient('http://DGS4DEV01.degson.com:8000/sap/bc/srt/wsdl/flv_10002A101AD1/bndg_url/sap/bc/srt/rfc/sap/zsd009ws/400/zsd009ws/zsd009ws?sap-client=400?wsdl',$login); 
		// echo "<pre>";
		// var_dump($soap->__getFunctions());//打印暴露的方法
		// echo "<pre>";
		// print("<br/>");
		// echo "<pre>";
		// print_r($soap->__getTypes());//可以获取接口需要传输的参数结构,并打印出来
		// echo "<pre>";
		// print("<br/>");

		// 初始化传参结构
		$ZSD_009 = new stdClass('ZSD_009');
		// 参数赋值
		$ZSD_009->I_KSCHL = 'ZPR0';
		$ZSD_009->I_KUNNR = 'CNA001';
		$ZSD_009->I_VKORG = '1000';
		$ZSD_009->I_VTWEG = '10';
		$ZSD_009->I_MATNR = '10010000001';
		$ZSD_009->I_ZPRICL = 'A305';
		$ZSD_009->I_KUNNR2 = '';
		$ZSD_009->E_STATUS = array();

		// 调用ZSD_009
		try{

			$result = $soap->ZSD_009($ZSD_009); //调用sap里的接口，调用失败测打印错误message查看原因
			echo "<pre>";
			print_r($result);
			echo "<pre>";

		}catch(Exception $e){
			// 打印失败信息
			print $e->getMessage();

		}

	}



}
